import FlashItem from './FlashItem'
import React, { useEffect } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from "redux"
import { actionCreaters as flashActionCreaters, actionTypes, reducer } from "./store"
const Flash = props => {
    useEffect(() => {
        console.log("flash componet props:",props);
    }, [])
    return (
        <React.Fragment>
            {
                props.flashData.map(item => <FlashItem key={item.id} {...item} {...props}/>)
            }
        </React.Fragment>
    )
}
const stateToProps = state => {
    console.log("uiuuuuuuuuuuu",state);
    return {
        flashData: state.flash
    }
}
const dispatchToProps = dispatch => {
    return {
        flashFn: bindActionCreators(flashActionCreaters, dispatch)
    }
}
export default connect(stateToProps, dispatchToProps)(Flash)